package com.fable.ntzw_ga.entity;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.annotations.Table;

import javax.persistence.*;

/**
 * @author Created by gzh 2023-02-19 23:49:51
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(appliesTo = "sys_role", comment = "系统角色表")
@Accessors(chain = true)
public class SysRole implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "角色id")
    @Column(name = "id", columnDefinition = "bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色id'")
    private Long id;

    @ApiModelProperty(value = "角色名称")
    @Column(name = "name", columnDefinition = "varchar(32) NOT NULL COMMENT '角色名称'")
    private String name;

    @ApiModelProperty(value = "角色编码")
    @Column(name = "code", columnDefinition = "varchar(32) NOT NULL COMMENT '角色编码'")
    private String code;

    @ApiModelProperty(value = "创建时间")
    @Column(name = "created", columnDefinition = "datetime(0) COMMENT '创建时间'")
    private LocalDateTime created;

    @ApiModelProperty(value = "修改时间")
    @Column(name = "updated", columnDefinition = "datetime(0) COMMENT '修改时间'")
    private LocalDateTime updated;

    @ApiModelProperty(value = "状态")
    @Column(name = "status", columnDefinition = "int(5) COMMENT '状态'")
    private Integer status = 1;

    @ApiModelProperty(value = "备注")
    @Column(name = "remark", columnDefinition = "varchar(255) COMMENT '备注'")
    private String remark;

    @Transient
    @TableField(exist = false)
    private List<Long> menuIds = new ArrayList<>();

}
